#pragma once

#include <queue>
#include <pthread.h>
#include <string>

struct Thread_Arg
{
	std::string str;
	char* data;
	unsigned size;
};

class MultiThreadWriter
{
public:
	static MultiThreadWriter* GetInstance();
	~MultiThreadWriter();

	static void* thread_func(void* arg);
	void AddTask(char* name, char* data, unsigned size);
	void SetExit() {m_flagExit = true;}
	pthread_t GetTid() {return m_tid;}

protected:
	MultiThreadWriter();

private:
	std::queue<Thread_Arg> m_threadArgTable;
	pthread_mutex_t m_mutexQueue;
	pthread_t m_tid;
	bool m_flagExit;
};
